Skip to content

HDDS-14386. Support bucket CORS configuration#10138

Open
ivandika3 wants to merge 21 commits intoapache:masterfrom
ivandika3:HDDS-14386
Open

HDDS-14386. Support bucket CORS configuration#10138
ivandika3 wants to merge 21 commits intoapache:masterfrom
ivandika3:HDDS-14386

Conversation

@ivandika3
Copy link
Copy Markdown
Contributor

@ivandika3 ivandika3 commented Apr 25, 2026

What changes were proposed in this pull request?

Currently, Ozone does not support per-bucket CORS configuration. This means that the CORS configuration is only decided on the reverse proxy that we use (e.g. nginx , HAProxy, etc).

We can implement per-bucket CORS configuration (https://docs.aws.amazon.com/AmazonS3/latest/userguide/cors.html) in Ozone. This way, we can have a separate bucket CORS response for different buckets. CORS is useful if user wanted to fetch S3 object using the browser which respects the CORS mechanism (CORS preflight request, origin validation, response header that can be exposed).

Generated by Codex (GPT 5.4).

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-14386

How was this patch tested?

UT, IT, Acceptance Tests.

Clean CI: https://github.com/ivandika3/ozone/actions/runs/24946282586

@ivandika3 ivandika3 added s3 S3 Gateway AI-gen labels Apr 25, 2026
@ivandika3 ivandika3 self-assigned this Apr 25, 2026
@ivandika3 ivandika3 requested a review from ChenSammi April 26, 2026 04:33
@ivandika3 ivandika3 marked this pull request as ready for review April 26, 2026 07:32
Comment on lines +240 to +250
if (ex.getResult() == ResultCodes.BUCKET_NOT_FOUND
|| ex.getResult() == ResultCodes.VOLUME_NOT_FOUND) {
throw newError(S3ErrorTable.NO_SUCH_BUCKET, bucketName, ex);
} else if (ex.getResult() == ResultCodes.INVALID_TOKEN) {
throw newError(S3ErrorTable.ACCESS_DENIED,
s3Auth.getAccessID(), ex);
} else if (ex.getResult() == ResultCodes.PERMISSION_DENIED) {
throw newError(S3ErrorTable.ACCESS_DENIED, bucketName, ex);
} else if (ex.getResult() == ResultCodes.TIMEOUT ||
ex.getResult() == ResultCodes.INTERNAL_ERROR) {
throw newError(S3ErrorTable.INTERNAL_ERROR, bucketName, ex);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we reuse existing error handler for get bucket?

Copy link
Copy Markdown
Contributor Author

@ivandika3 ivandika3 May 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this, I removed the reintroduction of EndpointBase#getBucket which was removed in #10097

However since S3RequestContext#getBucket carries the caching bucket logic, we need to change the other related endpoint handler (e.g. multiDeletes, head) to use S3RequestContext.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-gen s3 S3 Gateway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants